package 懒加载延时赋值

class ByLazyTest(_name: String) {
    var name = _name
    val config by lazy { loadConfig() }

    private fun loadConfig(): String {
        println("loading...")
        return "xxx"
    }
}

fun main() {
    val p = ByLazyTest("John")
    Thread.sleep(3000)
    println(p.config)
}